#ifdef _TEST_E_
#include "Spline.h"

vector<Vec<double, 2>> E_f(int N, double left, double right)
{
    vector<Vec<double, 2>> xy;
    for (int i = 0; i < N; i++)
    {
        double t = left + (right - left) * i / (N - 1);
        double x = sqrt(3) * cos(t);
        double y = 2.0 / 3 * sqrt(fabs(x)) + 2.0 / sqrt(3) * sin(t);
        xy.push_back({x, y});
    }
    return xy;
}

void fit_notAknot_spline(int N, char color)
{
    //分成两段插值
    Spline<2, 3, ppForm> spline = fitCurve<3>(E_f(N, PI / 2, 2.5 * PI), notAknot);
    spline.plot2(color);
}

int main()
{
    fit_notAknot_spline(10, 'b');
    fit_notAknot_spline(40, 'r');
    fit_notAknot_spline(160, 'g');

    return 0;
}

#endif
